function focusshare(id, url) {
    if ($.trim($("#" + id).html()) == "") {
        var po = document.createElement('script');
        po.type = 'text/javascript';
        po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(po, s);
        var html = "";
        html = "<div class='test' style='width:auto;'><li class='ulchildShareli fa'><iframe src='//www.facebook.com/plugins/like.php?href=" + url + "&amp;send=false&amp;layout=button_count&amp;width=60&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:85px; height:21px;' allowTransparency='true'></iframe></li></div>";
        html += "<div class='test' style='width:auto;'><li class='ulchildShareli tw'><iframe src='http://platform.twitter.com/widgets/tweet_button.html?url=" + url + "&amp;send=false&amp;layout=button_count&amp;width=60&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:85px; height:21px;' allowTransparency='true'></iframe></li></div>";
        html += "<div class='test' style='width:auto;'><li class='ulchildShareli goog'><g:plusone href='" + url + "' size='medium' annonation='none'></g:plusone></li></div>";
        $("#" + id).html(html);
    }
}

$(function() {
    $('.share-link').mouseenter(function() {
        $this = $(this);
        $this.find('.ulchildShare').show();
    });
    $('.share-link').mouseleave(function() {
        $this = $(this);
        $this.find('.ulchildShare').hide();
    });
});

$(document).ready(function() {
    $(".sapo").dotdotdot({
        'height': 50
    });
});

var photoDetail = {arr: [], divElement: ".news-detail", imgSr: "http://cdn1.autodaily.vn/", imgSr1: "http://cdn2.autodaily.vn/", imgSr2: "http://cdn3.autodaily.vn/", imgSr3: "http://autodaily.vn/wp-content", title: "", sapo: "", width: 0, height: 0, photoWidth: 0, flag: true,
    init: function() {
        var b = this;
        var c = "";
        b.title = $(".news-detail .single-title").text();
//        b.sapo = $(".news-detail .description").text();
        var advDetail2a = $('#banner2a').clone();
        var advDetail2b = $('#banner2b').clone();
        advDetail2a.attr('id', 'bannerslide2a');
        advDetail2b.attr('id', 'bannerslide2b');
        $('#adv-zone').append(advDetail2a);
        $('#adv-zone').append(advDetail2b); 
        var d = $(b.divElement).find('img[src*="' + b.imgSr + '"], img[src*="' + b.imgSr1 + '"], img[src*="' + b.imgSr2 + '"], img[src*="' + b.imgSr3 + '"]');

        d.each(function() {
            if (!$(this).parent().is("a") || true) {
                c += String.format('<li><a href="javascript:void(0)"><img src="{0}" alt="" /></a></li>', $(this).attr("src"));
                b.arr.push($(this).attr("src"))
            }
        });
        d.hover(function() {
            if (!$(this).parent().is('a[target="_blank"]')) {
                $(this).css("cursor", "-webkit-zoom-in");
                $(this).css("cursor", "-moz-zoom-in")
            }
        }, function() {
            if (!$(this).parent().is('a[target="_blank"]')) {
                $(this).css("cursor", "none")
            }
        });
        d.on("click", function() {
            if (!$(this).parent().is("a") || true) {
                b.openPopup();
                b.bindData($(this).attr("src"));
            }
            if ($(this).parent().is("a") && !$(this).parent().is('a[target="_blank"]')) {
                $(this).parent().on('click', function() {
                    var url = $(this).attr('href');
                    console.log(url);
                    console.log(url.indexOf("http://ads.autodaily.vn"));
                    if(url.indexOf("http://ads.autodaily.vn") == -1) {
                        return false;
                    }
                    
                });
            }
        });
        if (b.arr.length > 5) {
            $(".popup-slide ul").html(c);
            $(".popup-slide").show()
        }
        if (window.location.hash != "") {
            if (window.location.hash.split("#")[1].indexOf("lb") != -1) {
                lb = window.location.hash.split("#")[1].replace("lb", "");
                if ($(b.divElement).find('img[lb="' + lb + '"]') != null) {
                    b.openPopup();
                    b.bindData($(b.divElement).find('img[lb="' + lb + '"]').attr("src"))
                }
            }
        }
        $(".popup-detail-content > img").hover(function() {
            $(this).css("cursor", "pointer")
        });
        $(".popup-slide ul li").hover(function() {
            $(this).css("opacity", "1")
        }, function() {
            $(this).css("opacity", "0.3")
        });
        $("#popup-detail-left").hover(function() {
            if (b.isZoom() || !b.flag) {
                $(".popup-detail-content .zoom").fadeIn()
            } else {
                $(".popup-detail-content .zoom").hide()
            }
            if ($.inArray($(".popup-slide li.active img").attr("src"), b.arr) == 0) {
                if (b.arr.length == 1) {
                    return
                }
                $(".popup-detail-content .next").show()
            } else {
                if ($.inArray($(".popup-slide li.active img").attr("src"), b.arr) == b.arr.length - 1) {
                    $(".popup-detail-content .prev").show()
                } else {
                    $(".popup-detail-content .prev, .popup-detail-content .next").fadeIn()
                }
            }
        }, function() {
            $("#popup-detail-left .zoom").hide();
            $(".popup-detail-content .prev, .popup-detail-content .next").hide()
        })
    }, bindData: function(l) {
        var c = this;
        c.reset();
        $(window).resize(function() {
            c.resize(c.width, c.height)
        });
        $(".popup-detail-content .prev, .popup-detail-content .next").hide();
        $("#popup-detail-bg").scrollTop(0);
        $(".popup-detail-content li").removeClass("active");
        if ($.inArray(l, c.arr) == 0) {
            $(".popup-detail-content .next").show()
        } else {
            if ($.inArray(l, c.arr) == c.arr.length - 1) {
                $(".popup-detail-content .prev").show()
            } else {
                $(".popup-detail-content .prev, .popup-detail-content .next").fadeIn()
            }
        }
        next = "";
        prev = "";
        var r = 0;
        var h = 0;
        var f = "";
        for (i = 0; i < c.arr.length; i++) {
            if (c.arr[i] == l) {
                next = c.arr[i + 1];
                prev = c.arr[i - 1];
                break
            }
        }
        if ($(c.divElement).find('img[src="' + l + '"]').attr("w") != null) {
            r = $(c.divElement).find('img[src="' + l + '"]').attr("w")
        } else {
            r = $(c.divElement).find('img[src="' + l + '"]').width()
        }
        if ($(c.divElement).find('img[src="' + l + '"]').attr("h") != null) {
            h = $(c.divElement).find('img[src="' + l + '"]').attr("h")
        } else {
            h = $(c.divElement).find('img[src="' + l + '"]').height()
        }
        if ($(c.divElement).find('img[src="' + l + '"]').attr("lb") != null) {
            f = encodeURIComponent("#lb" + $(c.divElement).find('img[src="' + l + '"]').attr("lb"))
        }
        imgSize = c.getImgSize(l).split('|');
        if (imgSize.length == 2) {
            r = imgSize[0];
            h = imgSize[1];
        }
        c.width = r;
        c.height = h;
        $(".popup-detail-content > img").hide().attr("src", l.replace(/\/thumb_w\/([0-9]+)\//, "/")).delay(400).fadeIn();

        c.resize(r, h);
        c.callBack(next, prev);
        c.album_load(l);
        if (c.title != null) {
            $(".popup-detail-right-top h2").text(c.title)
        }
        if (c.sapo != null) {
            $(".popup-detail-right-top p").text(c.sapo)
        }
        /*var q = "100%";
         var k = c.app_key;
         var b = $.base64Encode(encodeURI(c.title));
         var d = "";
         if ($(c.divElement).find('img[src="' + l + '"]').attr("lb") != null) {
         d = window.location.protocol + "//" + window.location.host + window.location.pathname + f
         } else {
         d = l
         }
         var n = 5;
         var m = 1;
         var g = 0;
         var o = 0;
         var e = "mingid_comments_content_popup";
         var j = "mingId_frame_lightbox";
         $("#mingid_comments_content_popup").empty();
         MINGID_IFRAME_FUNC.mingidGenIfram(q, 238, k, d, b, n, m, g, o, d, e, j, 0, 0, 2);
         */
        if (c.isZoom() || !this.flag) {
            $(".popup-detail-content .zoom").fadeIn()
        } else {
            $(".popup-detail-content .zoom").hide()
        }
        c.adBoxHeight()
    }, openPopup: function() {
        $("#popup-detail-bg").fadeIn("slow");
        $("body").addClass("no-scroll");
        $("#scroll_top").hide();
        $(document).keyup(this.keyUp)
    }, closePopup: function() {
        $("#popup-detail-bg").fadeOut("slow");
        $("body").removeClass("no-scroll");
        $(document).off("keyup")
    }, resize: function(x, v) {
        var h = 320;
        var f = 320;
        var b = 700;
        var t = 600;
        var m = 90;
        var r = 70;
        var e = window.innerWidth - 100;
        var w = window.innerHeight - 75;
        e = (e < b) ? b : e;
        w = (w < t) ? t : w;
        var n = 320;
        var q = 15;
        var c = 30;
        var u = e - $("#popup-detail-right").innerWidth();
        u = (u < f) ? f : u;
        var l = u;
        if (x <= u) {
            l = x
        } else {
            l = u
        }
        var g = parseInt(l * v / x);
        if (g > w) {
            g = w - m;
            l = parseInt(x * g / v)
        }
        if (l < h) {
            l = h;
            g = parseInt(l * v / x)
        }
        while (g > w) {
            l = l - 10;
            g = parseInt(l * v / x)
        }
        $("#popup-detail-wrap").css({width: e});
        $("#popup-detail-left .move").hide();
        $("#popup-detail-left, .popup-detail-content").css("width", u);
        if ($("#popup-detail-left ul").html() != "") {
            $("#popup-detail-left, .popup-detail-content").css("height", w - r)
        } else {
            $("#popup-detail-left, .popup-detail-content").css("height", w)
        }
        $(".popup-detail-content > img").attr("width", l).attr("height", g);
        $("#popup-detail-left .move").hide();
        $("#popup-detail-right").css("height", w);
        var k = document.documentElement.clientWidth;
        var j = document.documentElement.clientHeight;
        var o = $("#popup-detail-wrap").width();
        var d = $("#popup-detail-wrap").height();
        $("#popup-detail-wrap").css({left: k / 2 - o / 2 - 10});
        this.flag = true
    }, callBack: function(c, b) {
        var d = this;
        $("#popup-detail-left .next, .popup-detail-content > img").off("click").on("click", function() {
            if (c != null) {
                d.bindData(c)
            } else {
                return false
            }
        });
        $("#popup-detail-left .prev").off("click").on("click", function() {
            if (b != null) {
                d.bindData(b)
            } else {
                return false
            }
        });
        $("#popup-detail-left .zoom").off("click").on("click", function() {
            if (d.isZoom() && d.flag) {
                d.flag = false;
                d.resizeFullScreen(d.width, d.height)
            } else {
                $("#popup-detail-left .move").hide();
                $(".popup-detail-right-box").css({position: "relative", left: "0", top: "0"});
                $("#popup-detail-bg").off("scroll");
                $(".popup-detail-content .next").css({position: "absolute", right: "30px"});
                $(".popup-detail-content .prev").css({position: "absolute", left: "30px"});
                d.flag = true;
                d.resize(d.width, d.height)
            }
        });
        $(".move").off("click").on("click", function() {
            var e = $("#popup-detail-bg").scrollTop();
            $("#popup-detail-bg").animate({scrollTop: e + 150}, "slow")
        });
        $(".popup-slide  ul li a img").off("click").on("click", function() {
            if ($(this).parent().parent("li").hasClass("active")) {
                return
            }
            d.bindData($(this).attr("src"))
        });
        $("#popup-detail-wrap").click(function() {
            return false
        });
        $("#popup-detail-bg").click(function() {
            d.closePopup()
        })
    }, keyUp: function(b) {
        b.preventDefault();
        if (b.keyCode == 27) {
            photoDetail.closePopup()
        }
        if (b.keyCode == 37) {
            $("#popup-detail-left .prev").click()
        }
        if (b.keyCode == 39) {
            $("#popup-detail-left .next").click()
        }
    }, resizeFullScreen: function(d, f) {
        var h = 70;
        var l = $("#popup-detail-right").innerWidth(true) + $("#popup-detail-wrap").position().left + 45 + "px";
        var e = $("#popup-detail-wrap").position().left + 30 + "px";
        $("#popup-detail-bg").scrollTop(0);
        if (d > $("#popup-detail-left").width()) {
            $(".popup-detail-content > img").attr({width: $("#popup-detail-left").width(), height: Math.round($("#popup-detail-left").width() * f / d)})
        } else {
            $(".popup-detail-content > img").attr({width: d, height: f})
        }
        $("#popup-detail-left").css("height", "auto");
        $(".popup-detail-content .next").css({position: "fixed", right: l});
        $(".popup-detail-content .prev").css({position: "fixed", left: e});
        if ($("#popup-detail-left ul").html() != "") {
            $("#popup-detail-right").css("height", $("#popup-detail-left").height() + h)
        } else {
            $("#popup-detail-left, .popup-detail-content").css("height", j);
            $("#popup-detail-right").css("height", $(".popup-detail-content").height())
        }
        var k = window.innerWidth - 100;
        var j = window.innerHeight - 75;
        var b = 15;
        var c = document.documentElement.clientWidth;
        var m = $("#popup-detail-wrap").width();
        var g = $("#popup-detail-left").width() + (c / 2 - m / 2 - 10) + b;
        $("#popup-detail-left .move").show();
        $("#popup-detail-bg").scroll(function() {
            var n = $(this).scrollTop();
            if (n > 35) {
                $(".popup-detail-right-box").css({position: "fixed", left: g, top: "0", height: j + 40});
                $("#popup-detail-left .move").hide()
            } else {
                $(".popup-detail-right-box").css({position: "relative", left: "0", top: "0"})
            }
        })
    }, isZoom: function() {
        zoom = false;
        if ((parseInt($(".popup-detail-content > img").attr("width"), 10) < parseInt(this.width, 10) && parseInt($(".popup-detail-content > img").attr("width"), 10) < parseInt($("#popup-detail-left").width(), 10)) || !this.flag) {
            zoom = true
        }
        return zoom
    }, album_load: function(m) {
        var k = this;
        var d = 0;
        var n = 50;
        var j = [];
        var b = 8;
        var c = 0;
        var l = $.inArray(m, k.arr);
        var h = 0;
        var e = l + 1;
        k.photoWidth = $("#popup-detail-left").width();
        $('.popup-slide li img[src="' + m + '"]').parent().parent().addClass("active");
        if (k.arr.length > 5) {
            if ($(".popup-slide ul").html() != "") {
                for (g = 0; g < k.arr.length; g++) {
                    j = k.getImgSize(k.arr[g]).split("|");
                    if (g > 0) {
                        d = d + b
                    }
                    d += parseInt(j[0] * n / j[1]);
                    if (d > k.photoWidth) {
                        continue
                    }
                    h = g + 1
                }
                if (k.photoWidth < d + (h * b)) {
                    $(".popup-slide li").css("float", "left").parent().css("width", "5000px");
                    if (e <= 5) {
                        $(".popup-slide ul").animate({left: "0"}, 500)
                    } else {
                        if (k.arr.length - l <= 5 && k.arr.length > 10) {
                            return
                        }
                        for (var g = 0; g < e - 5; g++) {
                            c += $('.popup-slide li img[src="' + k.arr[g] + '"]').parent().parent().outerWidth(true)
                        }
                        var f = c + ($(".popup-slide ul").position().left - 10);
                        $(".popup-slide ul").animate({left: "-=" + f}, 500)
                    }
                }
            }
        }
    }, getImgSize: function(b) {
        var c = new Image();
        c.src = b;
        p = $(c).ready(function() {
            return {width: c.width, height: c.height}
        });
        return p[0]["width"] + "|" + p[0]["height"]
    }, adBoxHeight: function() {
        var b = 0;
        box = 170;
        if (parseInt($("#popup-detail-right").height()) > 768) {
            b = $("#popup-detail-right").height() - $(".popup-detail-right-top").innerHeight(true) - box * 2
        } else {
            b = $("#popup-detail-right").height() - $(".popup-detail-right-top").innerHeight(true) - box
        }
        return b
    }, reset: function() {
        $("#popup-detail-left .move").hide();
        $(".popup-detail-content .popup-slide").hide();
        $(".popup-slide li").removeClass("active");
        $(".popup-detail-right-box").css({position: "relative", left: "0", top: "0"});
        $("#popup-detail-bg").off("scroll");
        $(".popup-detail-content .next").css({position: "absolute", right: "30px"});
        $(".popup-detail-content .prev").css({position: "absolute", left: "30px"});
        this.flag = true
    }};
String.format = function(d) {
    if (arguments.length <= 1) {
        return d
    }
    var b = arguments.length - 2;
    for (var c = 0; c <= b; c++) {
        d = d.replace(new RegExp("\\{" + c + "\\}", "gi"), arguments[c + 1])
    }
    return d
};
(function(e) {
    var b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    var c = function(h) {
        h = h.replace(/\x0d\x0a/g, "\x0a");
        var g = "";
        for (var j = 0; j < h.length; j++) {
            var f = h.charCodeAt(j);
            if (f < 128) {
                g += String.fromCharCode(f)
            } else {
                if ((f > 127) && (f < 2048)) {
                    g += String.fromCharCode((f >> 6) | 192);
                    g += String.fromCharCode((f & 63) | 128)
                } else {
                    g += String.fromCharCode((f >> 12) | 224);
                    g += String.fromCharCode(((f >> 6) & 63) | 128);
                    g += String.fromCharCode((f & 63) | 128)
                }
            }
        }
        return g
    };
    var d = function(f) {
        var h = "";
        var g = 0;
        var j = c1 = c2 = 0;
        while (g < f.length) {
            j = f.charCodeAt(g);
            if (j < 128) {
                h += String.fromCharCode(j);
                g++
            } else {
                if ((j > 191) && (j < 224)) {
                    c2 = f.charCodeAt(g + 1);
                    h += String.fromCharCode(((j & 31) << 6) | (c2 & 63));
                    g += 2
                } else {
                    c2 = f.charCodeAt(g + 1);
                    c3 = f.charCodeAt(g + 2);
                    h += String.fromCharCode(((j & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                    g += 3
                }
            }
        }
        return h
    };
    e.extend({base64Encode: function(h) {
            var l = "";
            var g, m, n, o, j, q, k;
            var f = 0;
            h = c(h);
            while (f < h.length) {
                g = h.charCodeAt(f++);
                m = h.charCodeAt(f++);
                n = h.charCodeAt(f++);
                o = g >> 2;
                j = ((g & 3) << 4) | (m >> 4);
                q = ((m & 15) << 2) | (n >> 6);
                k = n & 63;
                if (isNaN(m)) {
                    q = k = 64
                } else {
                    if (isNaN(n)) {
                        k = 64
                    }
                }
                l = l + b.charAt(o) + b.charAt(j) + b.charAt(q) + b.charAt(k)
            }
            return l
        }, base64Decode: function(h) {
            var l = "";
            var g, m, n;
            var o, j, q, k;
            var f = 0;
            h = h.replace(/[^A-Za-z0-9\+\/\=]/g, "");
            while (f < h.length) {
                o = b.indexOf(h.charAt(f++));
                j = b.indexOf(h.charAt(f++));
                q = b.indexOf(h.charAt(f++));
                k = b.indexOf(h.charAt(f++));
                g = (o << 2) | (j >> 4);
                m = ((j & 15) << 4) | (q >> 2);
                n = ((q & 3) << 6) | k;
                l = l + String.fromCharCode(g);
                if (q != 64) {
                    l = l + String.fromCharCode(m)
                }
                if (k != 64) {
                    l = l + String.fromCharCode(n)
                }
            }
            l = d(l);
            return l
        }})
})(jQuery);
$(document).ready(function() {
    photoDetail.init();
});

function JSONscriptRequest(b) {
    this.fullUrl = b;
    this.noCacheIE = "&noCacheIE=" + (new Date()).getTime();
    this.headLoc = document.getElementsByTagName("head").item(0);
    this.scriptId = "YJscriptId" + JSONscriptRequest.scriptCounter++
}
JSONscriptRequest.scriptCounter = 1;
JSONscriptRequest.prototype.buildScriptTag = function() {
    this.scriptObj = document.createElement("script");
    this.scriptObj.setAttribute("type", "text/javascript");
    this.scriptObj.setAttribute("src", this.fullUrl);
    this.scriptObj.setAttribute("id", this.scriptId)
};
JSONscriptRequest.prototype.removeScriptTag = function() {
    this.headLoc.removeChild(this.scriptObj)
};
JSONscriptRequest.prototype.addScriptTag = function() {
    this.headLoc.appendChild(this.scriptObj)
};
(function(aE, aF, aG) {
    function aR(f, h, j) {
        var b = aF.createElement(f);
        return h && (b.id = aJ + h), j && (b.style.cssText = j), aE(b)
    }
    function ak(d) {
        var e = ai.length, f = (aV + d) % e;
        return f < 0 ? e + f : f
    }
    function aT(c, d) {
        return Math.round((/%/.test(c) ? (d === "x" ? aj.width() : aj.height()) / 100 : 1) * parseInt(c, 10))
    }
    function ar(b) {
        return a5.photo || /\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?$/i.test(b)
    }
    function aN() {
        var c;
        a5 = aE.extend({}, aE.data(aU, aI));
        for (c in a5) {
            aE.isFunction(a5[c]) && c.slice(0, 2) !== "on" && (a5[c] = a5[c].call(aU))
        }
        a5.rel = a5.rel || aU.rel || "nofollow", a5.href = a5.href || aE(aU).attr("href"), a5.title = a5.title || aU.title, typeof a5.href == "string" && (a5.href = aE.trim(a5.href))
    }
    function a6(d, e) {
        aE.event.trigger(d), e && e.call(aU)
    }
    function az() {
        var f, h = aJ + "Slideshow_", j = "click." + aJ, k, l, m;
        a5.slideshow && ai[1] ? (k = function() {
            af.text(a5.slideshowStop).unbind(j).bind(ax, function() {
                if (a5.loop || ai[aV + 1]) {
                    f = setTimeout(a1.next, a5.slideshowSpeed)
                }
            }).bind(aw, function() {
                clearTimeout(f)
            }).one(j + " " + ay, l), ao.removeClass(h + "off").addClass(h + "on"), f = setTimeout(a1.next, a5.slideshowSpeed)
        }, l = function() {
            clearTimeout(f), af.text(a5.slideshowStart).unbind([ax, aw, ay, j].join(" ")).one(j, function() {
                a1.next(), k()
            }), ao.removeClass(h + "on").addClass(h + "off")
        }, a5.slideshowAuto ? k() : l()) : ao.removeClass(h + "off " + h + "on")
    }
    function aO(c) {
        aZ || (aU = c, aN(), ai = aE(aU), aV = 0, a5.rel !== "nofollow" && (ai = aE("." + aK).filter(function() {
            var d = aE.data(this, aI).rel || this.rel;
            return d === a5.rel
        }), aV = ai.index(aU), aV === -1 && (ai = ai.add(aU), aV = ai.length - 1)), aX || (aX = aY = !0, ao.show(), a5.returnFocus && aE(aU).blur().one(al, function() {
            aE(this).focus()
        }), an.css({opacity: +a5.opacity, cursor: a5.overlayClose ? "pointer" : "auto"}).show(), a5.w = aT(a5.initialWidth, "x"), a5.h = aT(a5.initialHeight, "y"), a1.position(), aC && aj.bind("resize." + am + " scroll." + am, function() {
            an.css({width: aj.width(), height: aj.height(), top: aj.scrollTop(), left: aj.scrollLeft()})
        }).trigger("resize." + am), a6(av, a5.onOpen), a4.add(ad).hide(), a3.html(a5.close).show()), a1.load(!0))
    }
    function ac() {
        !ao && aF.body && (aQ = !1, aj = aE(aG), ao = aR(aP).attr({id: aI, "class": aB ? aJ + (aC ? "IE6" : "IE") : ""}).hide(), an = aR(aP, "Overlay", aC ? "position:absolute" : "").hide(), ap = aR(aP, "Wrapper"), aq = aR(aP, "Content").append(aa = aR(aP, "LoadedContent", "width:0; height:0; overflow:hidden"), aM = aR(aP, "LoadingOverlay").add(aR(aP, "LoadingGraphic")), ad = aR(aP, "Title"), aL = aR(aP, "Current"), ag = aR(aP, "Next"), a2 = aR(aP, "Previous"), af = aR(aP, "Slideshow").bind(av, az), a3 = aR(aP, "Close")), ap.append(aR(aP).append(aR(aP, "TopLeft"), ae = aR(aP, "TopCenter"), aR(aP, "TopRight")), aR(aP, !1, "clear:left").append(at = aR(aP, "MiddleLeft"), aq, au = aR(aP, "MiddleRight")), aR(aP, !1, "clear:left").append(aR(aP, "BottomLeft"), ah = aR(aP, "BottomCenter"), aR(aP, "BottomRight"))).find("div div").css({"float": "left"}), ab = aR(aP, !1, "position:absolute; width:9999px; visibility:hidden; display:none"), a4 = ag.add(a2).add(aL).add(af), aE(aF.body).append(an, ao.append(ap, ab)))
    }
    function aS() {
        return ao ? (aQ || (aQ = !0, aD = ae.height() + ah.height() + aq.outerHeight(!0) - aq.height(), a7 = at.width() + au.width() + aq.outerWidth(!0) - aq.width(), a8 = aa.outerHeight(!0), a9 = aa.outerWidth(!0), ao.css({"padding-bottom": aD, "padding-right": a7}), ag.click(function() {
            a1.next()
        }), a2.click(function() {
            a1.prev()
        }), a3.click(function() {
            a1.close()
        }), an.click(function() {
            a5.overlayClose && a1.close()
        }), aE(aF).bind("keydown." + aJ, function(c) {
            var d = c.keyCode;
            aX && a5.escKey && d === 27 && (c.preventDefault(), a1.close()), aX && a5.arrowKey && ai[1] && (d === 37 ? (c.preventDefault(), a2.click()) : d === 39 && (c.preventDefault(), ag.click()))
        }), aE("." + aK, aF).live("click", function(b) {
            b.which > 1 || b.shiftKey || b.altKey || b.metaKey || (b.preventDefault(), aO(this))
        })), !0) : !1
    }
    var aH = {transition: "elastic", speed: 300, width: !1, initialWidth: "600", innerWidth: !1, maxWidth: !1, height: !1, initialHeight: "450", innerHeight: !1, maxHeight: !1, scalePhotos: !0, scrolling: !0, inline: !1, html: !1, iframe: !1, fastIframe: !0, photo: !1, href: !1, title: !1, rel: !1, opacity: 0.9, preloading: !0, current: "image {current} of {total}", previous: "previous", next: "next", close: "close", open: !1, returnFocus: !0, reposition: !0, loop: !0, slideshow: !1, slideshowAuto: !0, slideshowSpeed: 2500, slideshowStart: "start slideshow", slideshowStop: "stop slideshow", onOpen: !1, onLoad: !1, onComplete: !1, onCleanup: !1, onClosed: !1, overlayClose: !0, escKey: !0, arrowKey: !0, top: !1, bottom: !1, left: !1, right: !1, fixed: !1, data: undefined}, aI = "colorbox", aJ = "cbox", aK = aJ + "Element", av = aJ + "_open", aw = aJ + "_load", ax = aJ + "_complete", ay = aJ + "_cleanup", al = aJ + "_closed", aA = aJ + "_purge", aB = !aE.support.opacity && !aE.support.style, aC = aB && !aG.XMLHttpRequest, am = aJ + "_IE6", an, ao, ap, aq, ae, at, au, ah, ai, aj, aa, ab, aM, ad, aL, af, ag, a2, a3, a4, a5, aD, a7, a8, a9, aU, aV, aW, aX, aY, aZ, a0, a1, aP = "div", aQ;
    if (aE.colorbox) {
        return
    }
    aE(ac), a1 = aE.fn[aI] = aE[aI] = function(e, g) {
        var d = this;
        e = e || {}, ac();
        if (aS()) {
            if (!d[0]) {
                if (d.selector) {
                    return d
                }
                d = aE("<a/>"), e.open = !0
            }
            g && (e.onComplete = g), d.each(function() {
                aE.data(this, aI, aE.extend({}, aE.data(this, aI) || aH, e))
            }).addClass(aK), (aE.isFunction(e.open) && e.open.call(d) || e.open) && aO(d[0])
        }
        return d
    }, a1.position = function(k, l) {
        function j(b) {
            ae[0].style.width = ah[0].style.width = aq[0].style.width = b.style.width, aq[0].style.height = at[0].style.height = au[0].style.height = b.style.height
        }
        var m = 0, n = 0, o = ao.offset(), q = aj.scrollTop(), f = aj.scrollLeft();
        aj.unbind("resize." + aJ), ao.css({top: -90000, left: -90000}), a5.fixed && !aC ? (o.top -= q, o.left -= f, ao.css({position: "fixed"})) : (m = q, n = f, ao.css({position: "absolute"})), a5.right !== !1 ? n += Math.max(aj.width() - a5.w - a9 - a7 - aT(a5.right, "x"), 0) : a5.left !== !1 ? n += aT(a5.left, "x") : n += Math.round(Math.max(aj.width() - a5.w - a9 - a7, 0) / 2), a5.bottom !== !1 ? m += Math.max(aj.height() - a5.h - a8 - aD - aT(a5.bottom, "y"), 0) : a5.top !== !1 ? m += aT(a5.top, "y") : m += Math.round(Math.max(aj.height() - a5.h - a8 - aD, 0) / 2), ao.css({top: o.top, left: o.left}), k = ao.width() === a5.w + a9 && ao.height() === a5.h + a8 ? 0 : k || 0, ap[0].style.width = ap[0].style.height = "9999px", ao.dequeue().animate({width: a5.w + a9, height: a5.h + a8, top: m, left: n}, {duration: k, complete: function() {
                j(this), aY = !1, ap[0].style.width = a5.w + a9 + a7 + "px", ap[0].style.height = a5.h + a8 + aD + "px", a5.reposition && setTimeout(function() {
                    aj.bind("resize." + aJ, a1.position)
                }, 1), l && l()
            }, step: function() {
                j(this)
            }})
    }, a1.resize = function(b) {
        aX && (b = b || {}, b.width && (a5.w = aT(b.width, "x") - a9 - a7), b.innerWidth && (a5.w = aT(b.innerWidth, "x")), aa.css({width: a5.w}), b.height && (a5.h = aT(b.height, "y") - a8 - aD), b.innerHeight && (a5.h = aT(b.innerHeight, "y")), !b.innerHeight && !b.height && (aa.css({height: "auto"}), a5.h = aa.height()), aa.css({height: a5.h}), a1.position(a5.transition === "none" ? 0 : a5.speed))
    }, a1.prep = function(j) {
        function f() {
            return a5.w = a5.w || aa.width(), a5.w = a5.mw && a5.mw < a5.w ? a5.mw : a5.w, a5.w
        }
        function e() {
            return a5.h = a5.h || aa.height(), a5.h = a5.mh && a5.mh < a5.h ? a5.mh : a5.h, a5.h
        }
        if (!aX) {
            return
        }
        var k, l = a5.transition === "none" ? 0 : a5.speed;
        aa.remove(), aa = aR(aP, "LoadedContent").append(j), aa.hide().appendTo(ab.show()).css({width: f(), overflow: a5.scrolling ? "auto" : "hidden"}).css({height: e()}).prependTo(aq), ab.hide(), aE(aW).css({"float": "none"}), aC && aE("select").not(ao.find("select")).filter(function() {
            return this.style.visibility !== "hidden"
        }).css({visibility: "hidden"}).one(ay, function() {
            this.style.visibility = "inherit"
        }), k = function() {
            function n() {
                aB && ao[0].style.removeAttribute("filter")
            }
            var v, w, y = ai.length, d, m = "frameBorder", t = "allowTransparency", r, x, u;
            if (!aX) {
                return
            }
            r = function() {
                clearTimeout(a0), aM.hide(), a6(ax, a5.onComplete)
            }, aB && aW && aa.fadeIn(100), ad.html(a5.title).add(aa).show();
            if (y > 1) {
                typeof a5.current == "string" && aL.html(a5.current.replace("{current}", aV + 1).replace("{total}", y)).show(), ag[a5.loop || aV < y - 1 ? "show" : "hide"]().html(a5.next), a2[a5.loop || aV ? "show" : "hide"]().html(a5.previous), a5.slideshow && af.show();
                if (a5.preloading) {
                    v = [ak(-1), ak(1)];
                    while (w = ai[v.pop()]) {
                        x = aE.data(w, aI).href || w.href, aE.isFunction(x) && (x = x.call(w)), ar(x) && (u = new Image, u.src = x)
                    }
                }
            } else {
                a4.hide()
            }
            a5.iframe ? (d = aR("iframe")[0], m in d && (d[m] = 0), t in d && (d[t] = "true"), d.name = aJ + +(new Date), a5.fastIframe ? r() : aE(d).one("load", r), d.src = a5.href, a5.scrolling || (d.scrolling = "no"), aE(d).addClass(aJ + "Iframe").appendTo(aa).one(aA, function() {
                d.src = "//about:blank"
            })) : r(), a5.transition === "fade" ? ao.fadeTo(l, 1, n) : n()
        }, a5.transition === "fade" ? ao.fadeTo(l, 0, function() {
            a1.position(0, k)
        }) : a1.position(l, k)
    }, a1.load = function(f) {
        var g, h, j = a1.prep;
        aY = !0, aW = !1, aU = ai[aV], f || aN(), a6(aA), a6(aw, a5.onLoad), a5.h = a5.height ? aT(a5.height, "y") - a8 - aD : a5.innerHeight && aT(a5.innerHeight, "y"), a5.w = a5.width ? aT(a5.width, "x") - a9 - a7 : a5.innerWidth && aT(a5.innerWidth, "x"), a5.mw = a5.w, a5.mh = a5.h, a5.maxWidth && (a5.mw = aT(a5.maxWidth, "x") - a9 - a7, a5.mw = a5.w && a5.w < a5.mw ? a5.w : a5.mw), a5.maxHeight && (a5.mh = aT(a5.maxHeight, "y") - a8 - aD, a5.mh = a5.h && a5.h < a5.mh ? a5.h : a5.mh), g = a5.href, a0 = setTimeout(function() {
            aM.show()
        }, 100), a5.inline ? (aR(aP).hide().insertBefore(aE(g)[0]).one(aA, function() {
            aE(this).replaceWith(aa.children())
        }), j(aE(g))) : a5.iframe ? j(" ") : a5.html ? j(a5.html) : ar(g) ? (aE(aW = new Image).addClass(aJ + "Photo").error(function() {
            a5.title = !1, j(aR(aP, "Error").text("This image could not be loaded"))
        }).load(function() {
            var b;
            aW.onload = null, a5.scalePhotos && (h = function() {
                aW.height -= aW.height * b, aW.width -= aW.width * b
            }, a5.mw && aW.width > a5.mw && (b = (aW.width - a5.mw) / aW.width, h()), a5.mh && aW.height > a5.mh && (b = (aW.height - a5.mh) / aW.height, h())), a5.h && (aW.style.marginTop = Math.max(a5.h - aW.height, 0) / 2 + "px"), ai[1] && (a5.loop || ai[aV + 1]) && (aW.style.cursor = "pointer", aW.onclick = function() {
                a1.next()
            }), aB && (aW.style.msInterpolationMode = "bicubic"), setTimeout(function() {
                j(aW)
            }, 1)
        }), setTimeout(function() {
            aW.src = g
        }, 1)) : g && ab.load(g, a5.data, function(e, k, l) {
            j(k === "error" ? aR(aP, "Error").text("Request unsuccessful: " + l.statusText) : aE(this).contents())
        })
    }, a1.next = function() {
        !aY && ai[1] && (a5.loop || ai[aV + 1]) && (aV = ak(1), a1.load())
    }, a1.prev = function() {
        !aY && ai[1] && (a5.loop || aV) && (aV = ak(-1), a1.load())
    }, a1.close = function() {
        aX && !aZ && (aZ = !0, aX = !1, a6(ay, a5.onCleanup), aj.unbind("." + aJ + " ." + am), an.fadeTo(200, 0), ao.stop().fadeTo(300, 0, function() {
            ao.add(an).css({opacity: 1, cursor: "auto"}).hide(), a6(aA), aa.remove(), setTimeout(function() {
                aZ = !1, a6(al, a5.onClosed)
            }, 1)
        }))
    }, a1.remove = function() {
        aE([]).add(ao).add(an).remove(), ao = null, aE("." + aK).removeData(aI).removeClass(aK).die()
    }, a1.element = function() {
        return aE(aU)
    }, a1.settings = aH
})(jQuery, document, this);
$(document).ready(function() {
    $(".xemtiepwp").click(function(b) {
        page_stream = page_stream + 1;
        if (page_stream == 10) {
            $(".divxemtiepwp").hide();
            return false
        } else {
            load_box_stream(page_stream)
        }
    })
});
if ($(".nav2-content-submenu ").html() != null) {
    if ($(".nav2-content-submenu ").html().trim().length == 0) {
        $(".subnav").attr("style", "display:none");
        $(".adv-topbanner").attr("style", "padding-top:3px")
    }
}
var page_stream = 0;
var is_first_scroll = false;
waiting_scroll_home = false;
$(window).scroll(function() {
    if (is_first_scroll == false && page_stream < 3) {
        if ($("ul.scrollupdate:last li:last").offset() != null) {
            if (waiting_scroll_home == false && ($(window).scrollTop() + $(window).height()) > ($("ul.scrollupdate:last li:last").offset().top)) {
                waiting_scroll_home = true;
                page_stream = page_stream + 1;
                load_box_stream(page_stream);
                if (page_stream == 2) {
                    is_first_scroll = true
                }
            }
        }
    }
});